package kr.hkit.powerjava.chapter06.work2class;

 class Ifwork03 {

	private int gubun, hour, age;

	public Ifwork03() {
		super();
	}

	public Ifwork03(int gubun, int hour, int age) {
		this.gubun = gubun;
		this.hour = hour;
		this.age = age;
	}

	public void setTicket (int gubun, int hour, int age) {
		this.gubun = gubun;
		this.hour = hour;
		this.age = age;
	}
	
	public int getPrice() {
		int price = -1;
		if (gubun == 1) { //자유이용권
			if (hour < 17) { //주간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인 
						price = 25000;
					}else{ //대인
						price = 34000;
					}
				}
				
			} else { //야간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 21000;
					}else{ //대인
						price = 29000;
					}
				}
			}
			
		}else{//입장권 
			if (hour < 17) { //주간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 20000;
					}else{ //대인
						price = 27000;
					}
				}
				
			} else { //야간
				if (age < 3) { //영아 무료입장
					price = 0;
				}else{
					if (age < 13 || age > 64 ) { //소인
						price = 17000;
					}else{ //대인
						price = 23000;
					}
				}
			}
			
		}
	
		return price;
	}

	@Override
	public String toString() {
		return "입장료는 " + getPrice() + "입니다." ;
	}

}
 
 
